import request from '../../../request';
import { AxiosPromise } from 'axios';
import { TestDataVo, TestDataQuery, TestDataForm } from './types';

/**
 * 查询测试单列表
 * @param query
 * @returns {*}
 */
export const listTestData = (query?: TestDataQuery): AxiosPromise<TestDataVo[]> => {
  return request({
    url: '/test/data/page',
    method: 'get',
    params: query
  });
};

/**
 * 查询测试单详细
 * @param id
 */
export const getTestData = (id: string): AxiosPromise<TestDataVo> => {
  return request({
    url: '/test/data/' + id,
    method: 'get'
  });
};

/**
 * 新增测试单
 * @param data
 */
export const addTestData = (data: TestDataForm) => {
  return request({
    url: '/test/data',
    method: 'post',
    data: data
  });
};

/**
 * 修改测试单
 * @param data
 */
export const updateTestData = (data: TestDataForm) => {
  return request({
    url: '/test/data',
    method: 'put',
    data: data
  });
};

/**
 * 删除测试单
 * @param id
 */
export const delTestData = (id: string | Array<string>) => {
  return request({
    url: '/test/data/' + id,
    method: 'delete'
  });
};
